package com.kurumi.query;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.kurumi.util.StringUtil;

public class MedicalRecordDRGsQuery extends PageQuery {

	// 患者姓名
	private String patientName;

	// 病案唯一标识
	private String onlyId;

	// 病案号
	private String mrId;

	// 证件类型编号
	private String idDocumentTypeCode;

	// 证件号
	private String idNumber;

	// 出院开始时间
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	private Date outHospitalStartDate;

	// 出院结束时间
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
	private Date outHospitalEndDate;

	// 出院科室编号
	private String outHospitalDeptCode;

	// 出院方式编号
	private String outHospitalTypeCode;
	
	private String codingStatusCode;
	
	private String groupStatusCode;

	// 查询结果集
	private Object datas;

	public String getOnlyId() {
		return StringUtil.meaningStr(onlyId);
	}

	public void setOnlyId(String onlyId) {
		this.onlyId = onlyId;
	}

	public String getPatientName() {
		return StringUtil.meaningStr(patientName);
	}

	public void setPatientName(String patientName) {
		this.patientName = patientName;
	}

	public String getIdDocumentTypeCode() {
		return StringUtil.meaningStr(idDocumentTypeCode);
	}

	public void setIdDocumentTypeCode(String idDocumentTypeCode) {
		this.idDocumentTypeCode = idDocumentTypeCode;
	}

	public String getIdNumber() {
		return StringUtil.meaningStr(idNumber);
	}

	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}

	public Date getOutHospitalStartDate() {
		return outHospitalStartDate;
	}

	public void setOutHospitalStartDate(Date outHospitalStartDate) {
		this.outHospitalStartDate = outHospitalStartDate;
	}

	public Date getOutHospitalEndDate() {
		return outHospitalEndDate;
	}

	public void setOutHospitalEndDate(Date outHospitalEndDate) {
		this.outHospitalEndDate = outHospitalEndDate;
	}

	public String getMrId() {
		return StringUtil.meaningStr(mrId);
	}

	public void setMrId(String mrId) {
		this.mrId = mrId;
	}

	public String getOutHospitalDeptCode() {
		return StringUtil.meaningStr(outHospitalDeptCode);
	}

	public void setOutHospitalDeptCode(String outHospitalDeptCode) {
		this.outHospitalDeptCode = outHospitalDeptCode;
	}

	public String getOutHospitalTypeCode() {
		return StringUtil.meaningStr(outHospitalTypeCode);
	}

	public void setOutHospitalTypeCode(String outHospitalTypeCode) {
		this.outHospitalTypeCode = outHospitalTypeCode;
	}

	
	
	public String getCodingStatusCode() {
		return StringUtil.meaningStr(codingStatusCode);
	}

	public void setCodingStatusCode(String codingStatusCode) {
		this.codingStatusCode = codingStatusCode;
	}

	public String getGroupStatusCode() {
		return StringUtil.meaningStr(groupStatusCode);
	}

	public void setGroupStatusCode(String groupStatusCode) {
		this.groupStatusCode = groupStatusCode;
	}

	public Object getDatas() {
		return datas;
	}

	public void setDatas(Object datas) {
		this.datas = datas;
	}

	public boolean IsPropertyEmpty() {
		dealDate();
		if (this.getPatientName() ==null && this.getOnlyId() == null && this.getMrId() == null
				&& this.getIdDocumentTypeCode() == null && this.getIdNumber() == null
				&& this.getOutHospitalStartDate() == null&& this.getOutHospitalEndDate() == null
				&& this.getOutHospitalDeptCode() == null && this.getOutHospitalTypeCode() == null) {
			return true;
		}
		return false;
	}

	public boolean CodingExportEmpty() {
		dealDate();
		if (this.getOutHospitalStartDate() == null&& this.getOutHospitalEndDate() == null
				&& this.getCodingStatusCode() == null && this.getGroupStatusCode() == null) {
			return true;
		}
		return false;
	}
	
	
	private void dealDate() {
		if (this.getOutHospitalStartDate() == null && this.getOutHospitalEndDate() != null) {
			this.setOutHospitalStartDate(this.getOutHospitalEndDate());
		} else if (this.getOutHospitalStartDate() != null && this.getOutHospitalEndDate() == null) {
			this.setOutHospitalEndDate(this.getOutHospitalStartDate());
		}

	}
}
